<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<div id="div1"></div>
<div id="div2"></div>
<script src="itcast.js"></script>
<script>
     var arr=[];
    for(var i=0;i<8;i++){
        arr.push("歌曲"+i)
    };
     new F("#div1")[0].innerHTML=F.map(arr,function(v){
         return "<input type='checkbox'>"+v+"</br>";
     }).join("");
    var btns=[
        {name:"全选",id:"all"},
        {name:"全不选",id:"no"},
        {name:"反选",id:"fan"}
    ];
     new F("#div2")[0].innerHTML= F.map(btns,function(v){
         return "<input type='button' value='"+ v.name+"' id="+ v.id+">";
     }).join("");
     var inputs=new F("#div1 input");
    new F("#all")[0].onclick=function(){
        inputs.each(function(){
            this.checked=true
        })
    }

     new F("#no")[0].onclick=function(){
         inputs.each(function(i,v){
             v.checked=false
         })
     }
     new F("#fan")[0].onclick=function(){
         inputs.each(function(i,v){
             v.checked= !this.checked
         })
     }
</script>
</body>
</html>